const http = require('http');


const hostname = '127.0.0.1';
const port = 3200;

const server = http.createServer((req,res) => {

    res.statusCode = 200;
    res.setHeader('Content-Type','text/html;chartset=utf-8');

    const url = new URL(req.url,`http://${req.headers.host}`);
    const pathname = url.pathname;

    console.log(url);
    if(pathname === '/login') {

        // 登陆成功
        res.end('<h1 style="color:red;">login seccess</h1>');
    }else {

        // 返回回一个表单
        res.end('');
    }

    

})

server.listen(port,() => {
    console.log(`在${hostname}:${port}上的服务创建起来了~~`)
})